//
//  RoadTopV.m
//  TT
//
//  Created by Lenny on 16/4/18.
//  Copyright © 2016年 Lenny. All rights reserved.
//

#import "RoadTopV.h"

@interface RoadTopV ()

@property(nonatomic,strong)UIView *topDesV;

@end

@implementation RoadTopV

#pragma mark - public motheds
- (void)addUI {
    
    [self addSubview:self.topIV];
    [self addSubview:self.topDesV];
    [self.topDesV addSubview:self.timeBtn];
    [self.topDesV addSubview:self.longBtn];
   
    
    [self.topIV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.topDesV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(30);
    }];
    
    [self.timeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(-100);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.longBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.timeBtn.mas_right).offset(-80);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
}

#pragma mark - setter and getters

- (UIImageView *)topIV {
    
    if (_topIV == nil) {
        
        _topIV = [[UIImageView alloc] init];
        _topIV.backgroundColor = [UIColor redColor];
    }
    return _topIV;
}

- (UIView *)topDesV {
    
    if (_topDesV == nil) {
        
        _topDesV = [[UIView alloc] init];
        _topDesV.backgroundColor = [[UIColor yellowColor] colorWithAlphaComponent:0.5];
    }
    return _topDesV;
}

- (UIButton *)timeBtn {
    
    if (_timeBtn == nil) {
        
        _timeBtn = [[UIButton alloc] init];
        _timeBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        [_timeBtn setImage:[UIImage imageNamed:@"icon_time"] forState:UIControlStateNormal];
        [_timeBtn setTitle:@" 2016.03.24 14:20－15:20" forState:UIControlStateNormal];
        [_timeBtn setTitleColor:WL_Desc_Color forState:UIControlStateNormal];
    }
    return _timeBtn;
}

- (UIButton *)longBtn {
    
    if (_longBtn == nil) {
        
        _longBtn = [[UIButton alloc] init];
        
        _longBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        [_longBtn setImage:[UIImage imageNamed:@"icon_time"] forState:UIControlStateNormal];
        [_longBtn setTitle:@" 全程35KM" forState:UIControlStateNormal];
        [_longBtn setTitleColor:WL_Desc_Color forState:UIControlStateNormal];
    }
    return _longBtn;
}

@end
